home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / websea1a / module.bas next >
BASIC Source File  |  1999-09-15  |  2KB  |  47 lines

  1. Attribute VB_Name = "Module1"
  2. Option Explicit
  3. Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  4.  
  5. Private Function Execute(ByVal URL As String) As Long
  6.   Execute = ShellExecute(0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus)
  7. End Function
  8.  
  9. Public Function Search(Engine As Integer, SearchString As String)
  10. Dim i As Integer
  11.   'First replace spaces with "+"
  12.   i = 1
  13.   While i <= Len(SearchString)
  14.     If Mid(SearchString, i, 1) = " " Then Mid(SearchString, i, 1) = "+"
  15.     i = i + 1
  16.   Wend
  17.   'Now run default Internet browser with selected search engine and "SearchString"
  18.   Select Case Engine
  19.   Case 0
  20.     Execute "http://www.altavista.com/cgi-bin/query?pg=q&what=web&fmt=.&q=" & SearchString
  21.   Case 1
  22.     Execute "http://astalavista.box.sk/cgi-bin/astalavista/robot?srch=" & SearchString & "&project=robot&gfx=robot"
  23.   Case 2
  24.     Execute "http://www.ask.com/main/askJeeves.asp?ask=" & SearchString & "&origin=&qSource=0&site_name=Jeeves&metasearch=yes"
  25.   Case 3
  26.     Execute "http://www.excite.com/search.gw?search=" & SearchString & "&trace=2"
  27.   Case 4
  28.     Execute "http://www.hotbot.com/?MT=" & SearchString & "&SM=MC&DV=0&LG=any&DC=10&DE=2&_v=2&OPs=MDRTP"
  29.   Case 5
  30.     Execute "http://infoseek.go.com/Titles?qt=" & SearchString & "&col=WW&sv=IS&lk=noframes&svx=home_searchbox"
  31.              'if this adress will be not functional then try this:
  32.              '"http://www.go.com/Titles?qt=" & SearchString & "&col=WW&sv=IS&lk=noframes&svx=home_searchbox"
  33.   Case 6
  34.     Execute "http://search.msn.com/spbasic.htm?MT=" & SearchString
  35.   Case 7
  36.     Execute "http://www.lycos.com/cgi-bin/pursuit?query=" & SearchString & "&cat=dir"
  37.   Case 8
  38.     Execute "http://magellan.excite.com/search.gw?search=" & SearchString & "&c=web&look=magellan"
  39.   Case 9
  40.     Execute "http://www.metacrawler.com/cgi-bin/nph-metaquery.p?general=" & SearchString
  41.   Case 10
  42.     Execute "http://www.webcrawler.com/cgi-bin/WebQuery?" & SearchString
  43.   Case 11
  44.     Execute "http://av.yahoo.com/bin/search?p=" & SearchString
  45.   End Select
  46. End Function
  47.